package com.hvgroup.modules.sanic.domain.enums;

import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.ToString;

import java.util.Arrays;


/**
 * 知识库接口类型
 */
@Getter
@ToString
@AllArgsConstructor(access = AccessLevel.PRIVATE)
public enum DatasetIType {

    LIST_DATASET(1, "知识库列表"),
    LIST_DOCUMENT(2, "知识库文档列表"),
    CREATE_DOCUMENT_BY_FILE(3, "根据文件创建知识库文档"),
    DELETE_DOCUMENTS(4, "删除知识库文档");

    private final Integer value;
    private final String desc;

    public static DatasetIType fromName(String name) {
        return Arrays.stream(values())
                .filter(obj -> obj.name().equals(name)).findFirst()
                .orElseThrow(() -> new IllegalArgumentException("不存在的接口类型" + name));
    }

}
